package usb;

import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = new int[5];
        nums[0]=1;
        nums[1]=2;
        nums[2]=3;
        nums[3]=4;
        nums[4]=5;
        System.out.println("扩容前");
        for(int num : nums){
            System.out.print(num+"\t");
        }
        System.out.println();
        //扩容:创建新空间数组
        int[] numsNews=new int[10];
        //备份原始数组的数据
        for(int i=0;i<nums.length;i++){
            numsNews[i]=nums[i];
        }
        nums=numsNews;
        System.out.println("扩容后");
        for(int num : nums){
            System.out.print(num+"\t");
        }
        System.out.println();
    }
}
